<?php

    #-------------------------------------------------------------#
	# This file is part of the Tekuna MVC Microframework for PHP. #
	# (c) 2009 Niels Jäckel <niels.jaeckel@tekuna.org>            #
	# Please visit http://tekuna.org/ for more information.       #
	#                                                             #
	# This software is licensed under the MIT License. Please     #
	# view the LICENSE file for the full text of this license.    #
    #-------------------------------------------------------------#


	Tekuna :: load('org.tekuna.core.filter.TekunaFilter');


	/**
	 * This filter converts incoming values to float values. Both
	 * characters , and . are considered as a comma (german notation).
	 */

	class FloatFilter implements TekunaFilter {


		/**
		 * Transform the input value into a float value. Any occurence of
		 * a comma (,) will be transformed to a point (.) By doing this, the
		 * german float number notation with comma is supported implicitly.
		 *
		 * @param mixed $mInput the raw float value
		 * @return float a real float
		 */

		public function filter($mInput) {

			// replace german commas by points
			$mInput = str_replace(',', '.', $mInput);

			return floatval($mInput);
		}
	}
